#include "all.h"
#include <string>
#include <vector>


void run_in_fiber2() {
    LIBCO_LOG_INFO << "run_in_fiber2 begin";
    LIBCO_LOG_INFO << "run_in_fiber2 end";
}

void run_in_fiber() {
    LIBCO_LOG_INFO << "run_in_fiber begin";

    /**
     * 非对称协程，子协程不能创建并运行新的子协程，下面的操作是有问题的，
     * 子协程再创建子协程，原来的主协程就跑飞了
     */
    // libco::Coroutine::ptr fiber(new libco::Coroutine(run_in_fiber2, 0));
    // fiber->resume();

    LIBCO_LOG_INFO << "run_in_fiber end";
}

int main(int argc, char *argv[]) {
    LIBCO_LOG_INFO << "main begin";

    libco::Coroutine::GetThis();

    libco::Coroutine::ptr fiber(new libco::Coroutine(run_in_fiber, 0));
    fiber->resume();

    LIBCO_LOG_INFO << "main end";
    return 0;
}
